package 移掉K位数字;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String nums = in.next();
        int k = in.nextInt();
        StringBuilder res = new StringBuilder("0");
        for (int i = 0; i < nums.length(); i++) {
            while (res.length() > 0 && k > 0 && nums.charAt(i) < res.charAt(res.length() - 1)) {
                k--;
                res.deleteCharAt(res.length() - 1);
            }
            res.append(nums.charAt(i));
        }
        while (k-- > 0) {
            res.deleteCharAt(res.length() - 1);
        }
        while (res.charAt(0) == '0' && res.length() > 1) {
            res.deleteCharAt(0);
        }
        System.out.println(res);
    }
}
